<template>
	<view class="home-news" >
		<el-row>
			<el-col :lg="6" :sm="12" v-for="(category, index) in dataList" :key="index" class="padding-lg">
				<el-row type="flex" class="row-bg" justify="space-between">
					<el-col :span="12">
						<view class="text-bold text-xxl">{{category.categoryName}}</view>
					</el-col>
					<el-col :span="12" class="text-right">
						<view >
							<el-link @click="gotoCategory(category.id)">
								<view class="text-df text-gray">	更多 >> </view>
							</el-link>
						</view>
					</el-col>
				</el-row>
				<view class="content margin-top" v-for="(art, artindex) in category.articleVoList">
					<el-link @click="gotoArtDetail(art.id)">
						 <text class="text-lg text-cut" >
							<text class="cuIcon-news bg-blue margin-right-sm"></text>{{art.articleTitle}}
						 </text>
					</el-link>
				</view>
			</el-col>
		</el-row>
	</view>
</template>

<script>
	
	import { articleHome } from "@/api/cms.js"

	export default {
		name: "HomeNews",
		data() {
			return {
				dataList: [], //  数据列表
			};
		},
		mounted() {
			this.initData();
		},
		methods: {
			initData() {
				articleHome().then(res => {
					this.dataList = res.data;
				})
			},
			gotoCategory(id) {
				uni.navigateTo({
					url: "/pages/news/news?id=" + id
				})
			},
			gotoArtDetail(id) {
				uni.navigateTo({
					url: "/pages/news/newsDetail?id=" + id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	
	
</style>
